<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>新增学生信息</title>
    <link rel="stylesheet" type="text/css" href="css/main.css">
    <link rel="stylesheet" type="text/css" href="css/font-awesome.min.css">
    <style type="text/css">
        .form-group div {
            display: inline-block;
        }

        .form-group label {
            text-align: right;
        }
    </style>
</head>
<body>
<div class="modal-content">
    <div class="modal-header">
        <h4 class="modal-title">新增教师信息</h4>
    </div>
    <div class="modal-body">
        <form id="fm1" action="./doinsert" method="post">
            <div class="form-group">
                <label class="col-sm-2 control-label">教师姓名:</label>
                <div class="col-sm-3">
                    <input type="text" class="form-control" id="name" name="name" required>
                </div>
                <label class="col-sm-2 control-label">性别:</label>
                <div class="col-sm-3">
                    <input type="text" class="form-control" id="sex" name="sex" required>
                </div>
            </div>
            <div class="form-group">
                <!-- <label class="col-sm-2 control-label">性别:</label>
                <div class="col-sm-3">
                    <input type="text" class="form-control" id="sex" name="sex" value="" >
                </div> -->
                <label class="col-sm-2 control-label">手机号码:</label>
                <div class="col-sm-3">
                    <input type="text" class="form-control" id="phone" name="phone" onkeyup="fun()" required>
                </div>
                <sapn id="span2">0</sapn>
                /20
                <label class="col-sm-2 control-label">年龄:</label>
                <div class="col-sm-3">
                    <input type="text" class="form-control" id="time" name="time" required>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label">所教班级:</label>
                <div class="col-sm-3">
                    <input type="text" class="form-control" id="classcode" name="classcode" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">所教科目:</label>
                <div class="col-sm-3">
                    <input type="text" class="form-control" id="subject" name="subject" required>
                </div>
            </div>
            <div class="modal-footer">
                <button type="sumbit" class="btn btn-success" data-dismiss="modal">保存
                </button>
                <button type="button" class="btn btn-success" data-dismiss="modal"
                        onclick="javasrcipt:window.location.href='tomain'">返回
                </button>
            </div>
        </form>
    </div>
</div>
<script src="js/jquery-3.6.0.min.js"></script>
<script src="js/popper.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/main.js"></script>
<!-- 判断手机号长度 -->
<script type="text/javascript">
    function fun() {
        var a = $("#phone").val();
        $("#span2").text(a.length);
        if (a.length > 20) {
            alert("输入手机号码过长");
            document.getElementById("phone").value = "";
        }
    }
</script>
<!-- <script type="text/javascript">
function savestudent(){
    var name=$("#name").val();
    var code=$("#code").val();
    var classname=$("#classname").val();
    var age=$("#age").val();
    var phone=$("#phone").val();
    var schoolname=$("#schoolname").val();
    $.ajax({
        type:"post",
        url:"doinsert",
        dataType:"text",
        async:true,
        data:{
            "name":name,
            "code":code,
            "classname":classname,
            "age":age,
            "phone":phone,
            "schoolname":schoolname                  //这里的值用于后端，req.getparameter("对应这个地方")
        },
        success:function(data){
                alert("保存成功");
                window.location.href="tomain";     //保存后跳转首页
        },
        error:function(){
            alert("请求异常");
        }
    });
}
</script> -->
</body>
</html>